<script>
    {
        var a = 0 //var声明的变量 没有局部作用域
        let b = 1 //let 声明的变量 有局部作用域
    }
    console.log(a) //0
    // console.log(b) //ReferenceError: b is not defined
    console.log("-----------------")

    var m = 1 //var 可以声明多次
    var m = 2 // let 只能声明一次
    // let n = 3
    let n = 4
    console.log(m) //2
    console.log(n) //SyntaxError: Identifer 'n' has already been declared
    console.log("------------------------")

    const PI = "3.1415926" // 常量声明之后不允许改变
    //PI = 3 //TypeError: Assignment to constant variable

    //常量一旦声明必须初始化,否则会报错
    //const MY_AGE //SyntaxError: Missing initializer in const declaration
</script>